from flask import Flask
from toutiao.config import Config
from toutiao.model.db_routing import db


def create_app():
    app=Flask(__name__)
    app.config.from_object(Config)
    from toutiao.view.user_login import user_api
    from toutiao.view.relation import relation_api
    from toutiao.view.chnel import channel_api
    app.register_blueprint(user_api)
    app.register_blueprint(relation_api)
    app.register_blueprint(channel_api)
    app.secret_key='sdaddagafaf'
    with app.app_context():
        db.init_app(app)
        db.create_all()
    return app


app=create_app()


if __name__ == '__main__':
    app.run()
